SafetyResponsibilityBookManageForm = Ext.extend(Ext.Window, {
    constructor : function(a) {
        Ext.applyIf(this, a);
        this.initUIComponents();
        SafetyResponsibilityBookManageForm.superclass.constructor.call(this, {
            layout : "fit",
            items : yearGridFormPanel,
            modal : true,
            bodyStyle : "padding:2px;",
            buttonAlign : "center",
            buttons : yearGridFormButtons,
            title : (this.id>0?"修改":"添加")+"安全责任书",
            iconCls : "menu-flowWait",
            width : 620,
            height : 350
        });
    },
    initUIComponents : function() {
        createyeargridform({
            operation : this,
            form : {
                saveUrl : __ctxPath + "/saferesponsibility/saveSafetyResponsibilityBook.do",
                items : [ {
                    name : "safetyResponsibilityBook.id",
                    xtype : "hidden",
                    value : this.id == null ? "" : this.id
                }, {
                    name : "safetyResponsibilityBook.years",
                    xtype : "hidden",
                    value : this.years == null ? "" : this.years
                }, {
                    layout : "column", // 第一行
                    bodyStyle : "padding:5px;",
                    items : [ {
                        columnWidth : .5,//第一行第1列
                        border : false,
                        layout : "form",
                        defaultType : "textfield",
                        items : [ {
                            fieldLabel : '责任书编号' + '<font color=red>*</font>',
                            name : "safetyResponsibilityBook.responBookNo",
                            maxLength : 80,
                            width : 146,
                            allowBlank : false,
                            blankText : "责任书编号不能为空！"
                        } ]
                    }, {
                        columnWidth : .5,//第一行第2列
                        border : false,
                        layout : "form",
                        defaultType : "textfield",
                        items : [ {
                            fieldLabel : "责任书名称"+ '<font color=red>*</font>',
                            name : "safetyResponsibilityBook.responBookName",
                            maxLength : 80,
                            width : 146,
                            allowBlank : false,
                            blankText : "责任书名称不能为空！"
                        } ]
                    }]
                },{
                    layout : "column",
                    bodyStyle : "padding:5px;",
                    items : [ {
                        columnWidth : .5,
                        layout : "form",
                        border : false,
                        defaultType : "textfield",
                        items : [ {
                            fieldLabel : "责任书级别"+ '<font color=red>*</font>',
                            name : "safetyResponsibilityBook.responBookGrade", 
                            maxLength : 80,
                            width : 146,
                            allowBlank : false,
                            blankText : "责任书级别不能为空！"
                        } ]
                    }, {
                        layout : "form",
                        columnWidth : .5,
                        border : false,
                        items : [ {
                            xtype : "textfield",
                            fieldLabel : '适用岗位' + '<font color=red>*</font>',
                            name : "safetyResponsibilityBook.suitStation",
                            width : 146,
                            maxLength : 80,
                            allowBlank : false,
                            blankText : "适用岗位不能为空！"
                        } ]
                    }]
                },{
                    layout : "column",
                    bodyStyle : "padding:5px;",
                    items : [ {
                        columnWidth : .5,
                        layout : "form",
                        border : false,
                        defaultType : "textfield",
                        items : [ {
                            fieldLabel : "考核方"+ '<font color=red>*</font>',
                            name : "safetyResponsibilityBook.examiner", 
                            maxLength : 80,
                            width : 146,
                            allowBlank : false,
                            blankText : "考核方不能为空！"
                        } ]
                    }]
                },  {
                    layout : "column",
                    bodyStyle : "padding:5px;",
                    items : [ {
                        columnWidth : .5,
                        layout : "form",
                        border : false,
                        defaultType : "datefield",
                        items : [ {
                            fieldLabel : "生效日期"+ '<font color=red>*</font>',
                            name : "safetyResponsibilityBook.effectiveStartDate", 
                            maxLength : 80,
                            format: 'Y-m-d',
                            width : 146,
                            allowBlank : false,
                            blankText : "生效日期不能为空！"
                        } ]
                    }, {
                        layout : "form",
                        columnWidth : .5,
                        border : false,
                        items : [ {
                            xtype : "datefield",
                            fieldLabel : '失效日期' + '<font color=red>*</font>',
                            name : "safetyResponsibilityBook.effectiveEndDate",
                            width : 146,
                            maxLength : 80,
                            format: 'Y-m-d',
                            allowBlank : false,
                            blankText : "失效日期不能为空！"
                        } ]
                    }]
                },  {
                    layout : "column",
                    bodyStyle : "padding:5px;",
                    items : [{
                        columnWidth : 1,// 第一列
                        layout : "form",
                        border : false,
                        //bodyStyle : "padding:5px;",
                        items : [ {
                            xtype : "textarea",
                            fieldLabel : '备注',
                            name : 'safetyResponsibilityBook.remark',
                            width : 448,
                            maxLength : 80
                        } ]
                    } ]
                } ]
            },
            loadData : {
                getUrl : __ctxPath + "/saferesponsibility/getSafetyResponsibilityBook.do",
                preName : "safetyResponsibilityBook",
                callback : function(obj,formPanel){
                    if(!obj.effectiveStartDate){
                        formPanel.getCmpByName("safetyResponsibilityBook.effectiveStartDate").setValue(null);
                    }
                    if(!obj.effectiveEndDate){
                        formPanel.getCmpByName("safetyResponsibilityBook.effectiveEndDate").setValue(null);
                    }
                        
                }
            },
            isShow : this.isShow
        });
    }
});
